package com.huanwang.homelibrary;


import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;

import com.huanwang.commonlibrary.base.BaseViewActivityImpl;
import com.huanwang.homelibrary.databinding.ActivityMain2Binding;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;


public class MainActivity2 extends BaseViewActivityImpl<MViewModule> {

    private ArrayList<Fragment> list;

    @Override
    public int onLayoutID() {
        return R.layout.activity_main2;
    }

    @Override
    public void onLoadDate(@NotNull ViewDataBinding viewDataBinding) {
        ((ActivityMain2Binding)viewDataBinding).setMBean(new MBean("---"));
        // viewDataBinding.setMBean();
        list = new ArrayList<Fragment>();
        list.add(new MyFragment());
        list.add(new MyFragment());
        list.add(new MyFragment());

        ((ActivityMain2Binding)viewDataBinding).viewPager.setAdapter(new MyViewPageAdapter(getSupportFragmentManager(), FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT,list));
    }
}